<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>任务拆分成多个子任务</title>
</head>
<body>
    <script>
        function handle(){
            for(let i = 0; i < 1000000; i++){
                if(num <= 0) break;
                count += num--;
            }
            if(num > 0){
                // console.log(count);
                setTimeout(handle)
            }else{
                console.log(count);
            }
        }

        let num = 5435649;
        let count = 0;
        handle();

        console.log("后盾人");
    </script>
</body>
</html>